package com.atguigu.gmall.pay.config;

import com.alipay.api.AlipayClient;
import com.alipay.api.AlipayConfig;
import com.alipay.api.DefaultAlipayClient;
import com.atguigu.gmall.pay.config.properties.AlipayProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author lfy
 * @Description
 * @create 2023-08-05 10:44
 */
@Configuration
public class AlipayConfiguration {

    @Bean
    AlipayClient alipayClient(AlipayProperties properties){
        return new DefaultAlipayClient(properties.getGatewayUrl(),
                properties.getApp_id(), properties.getMerchant_private_key(),
                "json", properties.getCharset(), properties.getAlipay_public_key(),
                properties.getSign_type());
    }
}
